package IO;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class IO_Demo9 {
    public static void main(String[] args) {
//         使用 OutputStream 来写文件
        try(OutputStream outputStream = new FileOutputStream("./test2.txt",true)) {
//           append(追加) append true 追加写 在文件末尾追加写,不加 true 会清空文件写
            byte[] buffer = new byte[]{97,98,99,100,101,102};
            outputStream.write(buffer);
        }catch (IOException e){
            throw new RuntimeException(e);
        }
    }
}
